const express = require('express');
const router = express.Router();
const cors = require('../middlewares/cors');

//? 登录管理
const ControllerLogin = require('../controllers/admin/ControllerLogin'); //登录控制器

//? 七牛云上传
const ControllerQiniu = require('../controllers/admin/ControllerQiniu'); //七牛云上传

//? 首页
const ControllerHome = require('../controllers/admin/home/ControllerHome'); // 数据中心

//? 系统设置
const ControllerUser = require('../controllers/admin/system/ControllerUser'); //用户控制器
const ControllerMenu = require('../controllers/admin/system/ControllerMenu'); //菜单控制器
const ControllerRole = require('../controllers/admin/system/ControllerRole'); //角色控制器

//? 博客管理
const ControllerColumn = require('../controllers/admin/blog/ControllerColumn'); // 栏目管理
const ControllerArticle = require('../controllers/admin/blog/ControllerArticle'); //文章管理
const ControllerCategory = require('../controllers/admin/blog/ControllerCategory'); //分类管理
const ControllerTags = require('../controllers/admin/blog/ControllerTags'); // 标签管理

//? 友链管理
const ControllerLink = require('../controllers/admin/friend/ControllerLink'); // 友情链接

//? bbs管理
const ControllerComment = require('../controllers/admin/bbs/ControllerComment'); // 文章评论
const ControllerTalk = require('../controllers/admin/bbs/ControllerTalk'); // 留言


//! 七牛云上传
router.get('/qiniu/token', cors.allowAll, cors.allowUser, ControllerQiniu.uploadToken); // 七牛云上传TOKEN

//! 登录管理 
router.get('/captcha', cors.allowAll, ControllerLogin.sendCaptcha); // 获取验证码
router.post('/login', cors.allowAll, ControllerLogin.userLogin); //用户登录
router.put('/login/exit', cors.allowAll, cors.allowUser, ControllerLogin.userExit); //退出登录
router.get('/getAuthMenuList', cors.allowAll, cors.allowUser, ControllerLogin.getAuthMenuList); //获取权限菜单
router.get('/user/info', cors.allowAll, cors.allowUser, ControllerLogin.getUserDetail); // 获取用户信息

//! 首页
router.get('/home/list', cors.allowAll, cors.allowUser, ControllerHome.getList); // 获取数据

//! 系统设置
//* 用户管理 
router.get('/user/list', cors.allowAll, cors.allowUser, ControllerUser.getList); //获取用户列表
router.get('/user/detail', cors.allowAll, cors.allowUser, ControllerUser.getById); // 获取用户详情
router.post('/user/add', cors.allowAll, cors.allowUser, ControllerUser.Insert); // 创建用户
router.post('/user/update', cors.allowAll, cors.allowUser, ControllerUser.update); //用户编辑
router.delete('/user/del', cors.allowAll, cors.allowUser, ControllerUser.del); // 删除用户
router.get('/user/roleList', cors.allowAll, cors.allowUser, ControllerUser.getRoleList); // 获取角色列表
router.put('/user/updateInfo', cors.allowAll, cors.allowUser, ControllerUser.updateInfo); // 用户个人信息修改
router.put('/user/updatePassword', cors.allowAll, cors.allowUser, ControllerUser.updatePassword); // 修改个人密码

//* 菜单管理 
router.get('/menu/list', cors.allowAll, cors.allowUser, ControllerMenu.getList); // 获取菜单列表
router.get('/menu/detail/:id', cors.allowAll, cors.allowUser, ControllerMenu.getById) // 获取详情
router.post('/menu/add', cors.allowAll, cors.allowUser, ControllerMenu.Insert); // 添加菜单
router.post('/menu/update', cors.allowAll, cors.allowUser, ControllerMenu.update); // 修改菜单
router.delete('/menu/del', cors.allowAll, cors.allowUser, ControllerMenu.del); // 删除菜单

//* 角色管理
router.get('/role/list', cors.allowAll, cors.allowUser, ControllerRole.getList); // 获取角色列表
router.get('/role/detail', cors.allowAll, cors.allowUser, ControllerRole.getById); // 获取角色详情
router.post('/role/add', cors.allowAll, cors.allowUser, ControllerRole.Insert); // 添加角色
router.post('/role/update', cors.allowAll, cors.allowUser, ControllerRole.update); // 编辑角色
router.delete('/role/del', cors.allowAll, cors.allowUser, ControllerRole.del); // 删除角色
router.get('/role/getMenuList', cors.allowAll, cors.allowUser, ControllerRole.getMenuList); // 角色用户获取菜单列表
router.get('/role/getAuthList', cors.allowAll, cors.allowUser, ControllerRole.getAuthList); // 获取角色权限ID
router.post('/role/updateAuth', cors.allowAll, cors.allowUser, ControllerRole.updateAuth); // 添加角色权限

//! 博客管理
//* 栏目管理
router.get('/column/list', cors.allowAll, cors.allowUser, ControllerColumn.getList); // 获取列表
router.get('/column/detail', cors.allowAll, cors.allowUser, ControllerColumn.getById); // 获取详情
router.post('/column/add', cors.allowAll, cors.allowUser, ControllerColumn.Insert); // 栏目添加
router.post('/column/update', cors.allowAll, cors.allowUser, ControllerColumn.update); // 栏目编辑
router.delete('/column/del', cors.allowAll, cors.allowUser, ControllerColumn.del); // 栏目删除
router.post('/column/onUpdateSort', cors.allowAll, cors.allowUser, ControllerColumn.onUpdateSort); // 栏目排序

//* 文章管理
router.get('/article/tab', cors.allowAll, cors.allowUser, ControllerArticle.getTabs); // 获取tab列表
router.get('/article/list', cors.allowAll, cors.allowUser, ControllerArticle.getList); // 获取列表
router.get('/article/detail', cors.allowAll, cors.allowUser, ControllerArticle.getById); // 获取详情
router.post('/article/add', cors.allowAll, cors.allowUser, ControllerArticle.Insert); // 博文添加
router.post('/article/update', cors.allowAll, cors.allowUser, ControllerArticle.update); // 博文编辑
router.delete('/article/del', cors.allowAll, cors.allowUser, ControllerArticle.del); // 博文删除
router.get('/article/category', cors.allowAll, cors.allowUser, ControllerArticle.getCategoryList); // 文章分类列表
router.get('/article/tags', cors.allowAll, cors.allowUser, ControllerArticle.getTagList); // 标签列表
router.post('/article/onUpdateSort', cors.allowAll, cors.allowUser, ControllerArticle.onUpdateSort); // 博文排序
router.put('/article/stateChange', cors.allowAll, cors.allowUser, ControllerArticle.articleStateChange); //博文状态变更

//* 分类管理
router.get('/classify/list', cors.allowAll, cors.allowUser, ControllerCategory.getList); // 获取列表
router.get('/classify/detail', cors.allowAll, cors.allowUser, ControllerCategory.getById); // 获取详情
router.post('/classify/add', cors.allowAll, cors.allowUser, ControllerCategory.Insert); // 分类添加
router.post('/classify/update', cors.allowAll, cors.allowUser, ControllerCategory.update); // 分类编辑
router.delete('/classify/del', cors.allowAll, cors.allowUser, ControllerCategory.del); // 分类删除
router.post('/classify/onUpdateSort', cors.allowAll, cors.allowUser, ControllerCategory.onUpdateSort); // 分类排序

//* 标签管理
router.get('/tags/list', cors.allowAll, cors.allowUser, ControllerTags.getList); // 获取列表
router.get('/tags/detail', cors.allowAll, cors.allowUser, ControllerTags.getById); // 获取详情
router.post('/tags/add', cors.allowAll, cors.allowUser, ControllerTags.Insert); // 标签添加
router.post('/tags/update', cors.allowAll, cors.allowUser, ControllerTags.update); // 标签编辑
router.delete('/tags/del', cors.allowAll, cors.allowUser, ControllerTags.del); // 标签删除
router.post('/tags/onUpdateSort', cors.allowAll, cors.allowUser, ControllerTags.onUpdateSort); // 标签排序

//! 友链管理
//* 友情链接
router.get('/link/list', cors.allowAll, cors.allowUser, ControllerLink.getListL); //获取列表
router.get('/link/detail', cors.allowAll, cors.allowUser, ControllerLink.getById); //获取列表
router.post('/link/add', cors.allowAll, cors.allowUser, ControllerLink.Insert); //获取列表
router.post('/link/update', cors.allowAll, cors.allowUser, ControllerLink.update); //获取列表
router.delete('/link/del', cors.allowAll, cors.allowUser, ControllerLink.del); //获取列表

//! bbs管理
//* 文章评论
router.get('/comment/category', cors.allowAll, cors.allowUser, ControllerComment.getCategory); // 获取文章分类
router.get('/comment/article', cors.allowAll, cors.allowUser, ControllerComment.getArticle); // 获取文章列表
router.get('/comment/list', cors.allowAll, cors.allowUser, ControllerComment.getList); // 获取文章列表
router.get('/comment/detail', cors.allowAll, cors.allowUser, ControllerComment.getById); // 获取详情
router.post('/comment/add', cors.allowAll, cors.allowUser, ControllerComment.Insert); // 新增评论
router.post('/comment/reply', cors.allowAll, cors.allowUser, ControllerComment.reply); // 回复
router.delete('/comment/del', cors.allowAll, cors.allowUser, ControllerComment.del); // 删除评论

//* 留言
router.get('/talk/list', cors.allowAll, cors.allowUser, ControllerTalk.getList); // 获取列表
router.get('/talk/detail', cors.allowAll, cors.allowUser, ControllerTalk.getById); // 获取详情
router.post('/talk/add', cors.allowAll, cors.allowUser, ControllerTalk.Insert); // 新增
router.post('/talk/update', cors.allowAll, cors.allowUser, ControllerTalk.update); // 编辑
router.delete('/talk/del', cors.allowAll, cors.allowUser, ControllerTalk.del); // 删除
router.post('/talk/reply', cors.allowAll, cors.allowUser, ControllerTalk.reply); // 回复

module.exports = router;
